-
Notifications
You must be signed in to change notification settings - Fork 43
Also export minor grid #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lucasb-eyer
wants to merge
2
commits into
mpld3:master
Choose a base branch
from
lucasb-eyer:lb-minor-grid
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will allow to render both major and minor gridlines in mpld3, which fixes the following issue: mpld3/mpld3#527 As per usual, disclaimer that I co-developed this with gpt-5.1-codex, having it figure out the issues and give implementation recommendations, with me testing, verifying, and tidying up the code. Here's what it has to say, especially wrt the change in API call: - include minor tick values/length and minor grid style in axis props so minor ticks/grids render in mpld3 - read grid color/linewidth/linestyle from tick kwargs (and rcParams fallback) instead of inspecting gridlines[0], avoiding the get_gridlines(which=…) API that isn’t available on matplotlib 3.10” Rationale for the kw/rc approach: `Axis.get_gridlines()` doesn’t accept `which` on matplotlib 3.10, so probing `gridlines[0]` for minor/major fails. Pulling style from the tick keyword dict (which matplotlib populates with `grid_*` fields when you call `ax.grid(...)`) plus `rcParams` defaults gives the same style without needing `get_gridlines(which=…)`, keeping compatibility and matching user-set grid styles. (I verified, indeed get_gridlines does not allow specifying which ones - seems like an omission in matplotlib API to me)
lucasb-eyer
added a commit
to lucasb-eyer/mpld3
that referenced
this pull request
Dec 1, 2025
The js-side of mpld3/mplexporter#73 and fixes mpld3#527 Also adds some tests for minor-grid. It seems that the uglify is getting tripped up by `??`, so we should consider upgrading it, because a little chunk of this code could be quite a bit less verbose with that. Anyways, as usual disclaimer about having co-developed this with gpt-5.1-codex, but also tested and carefully reviewed/cleaned it. Here's what it has to say: - carry filtered minor tick values/length into axis props and draw a separate minor grid/tick layer - streamline axis getGrid tick selection and style passthrough to grids
lucasb-eyer
added a commit
to lucasb-eyer/mpld3
that referenced
this pull request
Dec 2, 2025
The js-side of mpld3/mplexporter#73 and fixes mpld3#527 Also adds some tests for minor-grid. It seems that the uglify is getting tripped up by `??`, so we should consider upgrading it, because a little chunk of this code could be quite a bit less verbose with that. Anyways, as usual disclaimer about having co-developed this with gpt-5.1-codex, but also tested and carefully reviewed/cleaned it. Here's what it has to say: - carry filtered minor tick values/length into axis props and draw a separate minor grid/tick layer - streamline axis getGrid tick selection and style passthrough to grids
lucasb-eyer
added a commit
to lucasb-eyer/mpld3
that referenced
this pull request
Dec 2, 2025
The js-side of mpld3/mplexporter#73 and fixes mpld3#527 Also adds some tests for minor-grid. It seems that the uglify is getting tripped up by `??`, so we should consider upgrading it, because a little chunk of this code could be quite a bit less verbose with that. Anyways, as usual disclaimer about having co-developed this with gpt-5.1-codex, but also tested and carefully reviewed/cleaned it. Here's what it has to say: - carry filtered minor tick values/length into axis props and draw a separate minor grid/tick layer - streamline axis getGrid tick selection and style passthrough to grids
lucasb-eyer
added a commit
to lucasb-eyer/mpld3
that referenced
this pull request
Dec 3, 2025
The js-side of mpld3/mplexporter#73 and fixes mpld3#527 Also adds some tests for minor-grid. It seems that the uglify is getting tripped up by `??`, so we should consider upgrading it, because a little chunk of this code could be quite a bit less verbose with that. Anyways, as usual disclaimer about having co-developed this with gpt-5.1-codex, but also tested and carefully reviewed/cleaned it. Here's what it has to say: - carry filtered minor tick values/length into axis props and draw a separate minor grid/tick layer - streamline axis getGrid tick selection and style passthrough to grids
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(note: builds on top of https://github.com/mpld3/mplexporter/pull/72/files so contains that commit, which I'll make disappear after merge+rebase)
This will allow to render both major and minor gridlines in mpld3, which
fixes the following issue: mpld3/mpld3#527
As per usual, disclaimer that I co-developed this with gpt-5.1-codex,
having it figure out the issues and give implementation recommendations,
with me testing, verifying, and tidying up the code.
Here's what it has to say, especially wrt the change in API call:
Rationale for the kw/rc approach:
Axis.get_gridlines()doesn’t acceptwhichon matplotlib 3.10, so probinggridlines[0]for minor/major fails. Pulling style from the tick keyword dict (which matplotlib populates withgrid_*fields when you callax.grid(...)) plusrcParamsdefaults gives the same style without needingget_gridlines(which=…), keeping compatibility and matching user-set grid styles.(I verified, indeed get_gridlines does not allow specifying which ones - seems like an omission in matplotlib API to me)
Screenshot of it working, blue are the minor ticks. Note the minor tick labels are not yet shown, I'll work on that later - maybe updating this PR in-place, or with a new one on top, depending on how simple/complex it is.
